#include "broweserconfiguration.h"
#include "ui_broweserconfiguration.h"

#include <QWebSettings>

namespace Legenday{

BrowserConfigurationDialog::BrowserConfigurationDialog(QWidget *parent) :
	QDialog(parent),
	ui(new Ui::BrowserConfigurationDialog)
{
	ui->setupUi(this);
}

BrowserConfigurationDialog::~BrowserConfigurationDialog()
{
	delete ui;
}


void	BrowserConfigurationDialog::on_buttonBox_accepted()
{
	QWebSettings *settings = QWebSettings::globalSettings();

	settings->setAttribute( QWebSettings::AutoLoadImages              , ui->autoloadImages->isChecked() );
	settings->setAttribute( QWebSettings::JavascriptEnabled           , ui->javaScriptEnabled->isChecked() );
	settings->setAttribute( QWebSettings::JavascriptCanOpenWindows    , ui->javaScriptCanOpenWindows->isChecked() );
	settings->setAttribute( QWebSettings::JavascriptCanAccessClipboard, ui->javaScriptCanAccessClipboard->isChecked() );
	settings->setAttribute( QWebSettings::LinksIncludedInFocusChain   , ui->linksIncludedInFocusChain->isChecked() );
	settings->setAttribute( QWebSettings::ZoomTextOnly                , ui->zoomTextOnly->isChecked() );
	settings->setAttribute( QWebSettings::PrintElementBackgrounds     , ui->printElementBackground->isChecked() );
	settings->setAttribute( QWebSettings::LocalStorageEnabled         , ui->localStorage->isChecked() );
}

}
